<table cellpadding="1" cellspacing="5" style="border-spacing:15px; border-collapse:separate;">
    <tr><td width="29"></td>
      <td>&nbsp;</td>
      <td></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td></td>
      <td align="right">属于类别：
        
      </td>
      <td>
      	<select id="cid" name="cid" class="Ipt" onchange="location.href='<?php echo $this->config->base_url('manager/attribute'); ?>?cid='+this.value">
        <option value="">...请选择类别</option>
        <option<?php if($cid == '0') { echo ' selected="selected"'; }?> value="0">通用属性(全类别通用)</option>
         <?php 
         if(!empty($channel)) {
             foreach($channel as $k=>$v) {
				 $disable = '';
				 if($v['parent'] == 0 && !empty($v['children'])) $disable = 'disabled="disabled"';
				 $select = $cid == $v['cid'] ? 'selected="selected"' : NULL;
                 $depth = "";
                 for($i = 0; $i < $v['depth']; $i++) {
                     $depth .= '﹣';
                 }
                 echo "<option ". $select." ".$disable." value='".$v['cid']."'>".$depth.$v['title']. '(' . $v['en_title'] . ')' . "</option>";
             }
         }
         ?>
      </select></td>
      <td align="right">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>                                
    <tr>
      <td></td>
      <td align="right">属性标题：</td>
      <td><select name="father_id" class="Ipt" id="father_id"><option value="">...请选择属性标题</option>
	  <?php if(!empty($attribute)) {
		  foreach($attribute as $k => $v) {
			  $comm_attribute = '[类别属性]-';
			  if($v['cid'] == 0) $comm_attribute = '[通用属性]-';
			  if($v['is_father'] == 1 && $v['cid'] == $cid) echo '<option value="'
			  	.$v['aid'].'">'.$comm_attribute.$v['title'].'</option>';
		  }}
	  ?></select></td>
      <td align="left"></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td></td>
      <td align="right">属性名称：      </td>
      <td><input class="Ipt" id="title" type="text" value="" name="title" onBlur="this.className='Ipt'" onFocus="this.className='IptOnF'"> <input class="Ipt" name="is_father" id="is_father" type="checkbox" value="1" />
      做为属性标题</td>
      <td align="left"></td>
      <td>&nbsp;</td>
    </tr>                                                                <tr>
      <td></td>
      <td align="right">属性英文名称： </td>
      <td><input class="Ipt" id="en_title" type="text" value="" name="en_title" onBlur="this.className='Ipt'" onFocus="this.className='IptOnF'"></td>
      <td align="right">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>                                <tr>
      <td></td>
      <td align="right">筛选项： </td>
      <td><input type="radio" name="is_filter" id="is_filter1" value="1" />
        是
          <input type="radio" name="is_filter" id="is_filter0" value="0" checked="checked" />
        否 （最多有8个筛选项）</td>
      <td align="left"></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td></td>
      <td>&nbsp;</td>
      <td>包括通用属性，已设置 <?php echo $filterCount; ?> 个筛选项</td>
      <td align="right">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td align="right">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td></td>
      <td>&nbsp;</td>
      <td><input class="Btn BtnNml" onMouseOver="this.className='Btn BtnHv'" onMouseOut="this.className='Btn BtnNml'" type="submit" value="增加类别属性">
      <input name="__H" value="add" type="hidden" />
      </td>
      <td></td>
      <td></td>
    </tr>
</table>
<script>
function checkdata() {
	var filterCount = <?php echo $filterCount; ?>;
	if(filterCount >= 8 && $('#is_filter1').attr('checked') == true) {
		parent.myshow('最多只能有8个筛选项！');
		return false;	
	}
	if($('#cid').val() == '') {
		parent.myshow('请选择类别！');
		return false;	
	}
	if($('#title').val() == '') {
		parent.myshow('属性名称是必填项！');
		return false;	
	}
	if($('#is_father').attr('checked') == true && $('#is_filter1').attr('checked') == true) {
		parent.myshow('做为属性标题不能是筛选项！');
		return false;	
	}
	if($('#father_id').val() == '' && $('#is_father').attr('checked') == false) {
		parent.myshow('没有选择属性标题，需要选择属性标题才能添加属性！');
		return false;	
	}
	if($('#father_id').val() != '' && $('#is_father').attr('checked') == true) {
		parent.myshow('选择了"属性标题项"，不能勾选"做为属性标题"');
		return false;	
	}
}
</script>
<h4 id="oH4Check" class="Ibx_Lst_bExtra">属性管理</h4>
<style type="text/css">
.host_list{}
.host_list tr{border-bottom:1px solid #CCC;}
.host_list tr td{font-size:12px;}
</style>
<table class="host_list" id="host_list" cellpadding="1" cellspacing="5" style="border-spacing:15px; border-collapse:separate; border-bottom:solid 1px #CCC;">
    <tr>
      <td></td>
      <td>属性标题</td>
      <td>名称</td>
      <td>英文名称</td>
      <td>筛选项</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>操作</td>
    </tr>
    <?php if(!empty($attribute)) {
		  foreach($attribute as $k => $v) {
			  $comm_attribute = '[通用标题]';
			  if($v['cid'] == $cid && $v['is_father'] == '0') {
				  if(isset($attribute_title[$v['father_id']])) $comm_attribute = $attribute_title[$v['father_id']]['title'];
   ?>
    <tr id="title">
        <td width="29"></td>
        <td><?php echo $comm_attribute;?></td>
        <td><?php echo $v['title'];?></td>
        <td><?php echo $v['en_title'];?></td>
        <td><?php if($v['is_filter'] == 1) {echo '是';} else { echo '否';}?></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>修改 | 删除</td>
    </tr>
    <?php }}} ?>   
</table>

<?php include 'inc/#edit_div.php';?>
